<template>
   <div class="special">
    <!-----头部+导航----->
      <div class="special_head">
        <div class="special_menu">
            <ul class="flex flex-space-around">
                <li v-for="item in navList">
                  <a v-if="item.id" :href="item.href + '?catid=' + item.id" target="_blank">
                    {{ item.name }}
                  </a> 
                  <a v-else :href="item.href" target="_blank">
                    {{ item.name }}
                  </a>                   
                </li>
            </ul>
        </div>
      </div>

      <!-----图片新闻+通知公告------>
      <div class="special_main clearfix">
        <div class="special_phont fl">
            <el-carousel height="376px" arrow="always">
            <el-carousel-item v-for="(item, index) in photo_news" :key="index">
                <div class="lunbo_img">
                    <a v-if="item.returnurl && item.returnurl != ''" :href="item.returnurl" target="_blank">
                    <img :src="item.picurl" />
                    <p>{{item.infotitle}}</p>
                    </a>
                    <a v-else :href="'/article?id=' + item.infoid" target="_blank">
                    <img :src="item.picurl" />
                    <p>{{item.infotitle}}</p>
                    </a>
                </div>
            </el-carousel-item>
            </el-carousel>
        </div>
        <!-----通知公告----->
        <div class="special_note fr">
            <div class="title flex flex-align-center flex-pack-justify">
              <div class="wz">通知公告</div>
              <div class="more"><a :href="'/list?catid=' + notice_id" target="_blank">查看更多</a></div>
            </div>
            <ul>
              <li v-for="item in notice_news">
                <a v-if="item.returnurl && item.returnurl != ''" :href="item.returnurl" target="_blank" class="flex flex-align-center">
                  <i class="iconfont icon-yuandianxiao"></i>
                  <div class="txt">{{item.infotitle}}</div>
                </a>
                <a v-else :href="'/article?id=' + item.infoid" target="_blank" class="flex flex-align-center">
                  <i class="iconfont icon-yuandianxiao"></i>
                  <div class="txt">{{item.infotitle}}</div>
                </a>                
              </li>
            </ul>
        </div>
      </div>

      <!-----工作开展动态情况+学习教育资料------>
      <div class="special_main clearfix">
        <!----工作开展动态情况----->
        <div class="special_study fl">
          <div class="title flex flex-align-center flex-pack-justify">
            <div class="wz">工作开展动态情况</div>
            <div class="more"><a :href="'/list?catid=' + study_id" target="_blank">查看更多</a></div>
          </div>
          <ul>
            <li v-for="item in work_news">
              <a v-if="item.returnurl && item.returnurl != ''" :href="item.returnurl" target="_blank" class="flex flex-align-center">
                <i class="iconfont icon-yuandianxiao"></i>
                <div class="txt">{{item.infotitle}}</div>
              </a>
              <a v-else :href="'/article?id=' + item.infoid" target="_blank" class="flex flex-align-center">
                <i class="iconfont icon-yuandianxiao"></i>
                <div class="txt">{{item.infotitle}}</div>
              </a>  
            </li>
          </ul>
        </div>
        <!----工作开展动态情况----->
        <div class="special_study fl">
          <div class="title flex flex-align-center flex-pack-justify">
            <div class="wz">学习教育资料</div>
            <div class="more"><a :href="'/list?catid=' + study_id" target="_blank">查看更多</a></div>
          </div>
          <ul>
            <li v-for="item in study_news">
              <a v-if="item.returnurl && item.returnurl != ''" :href="item.returnurl" target="_blank" class="flex flex-align-center">
                <i class="iconfont icon-yuandianxiao"></i>
                <div class="txt">{{item.infotitle}}</div>
              </a>
              <a v-else :href="'/article?id=' + item.infoid" target="_blank" class="flex flex-align-center">
                <i class="iconfont icon-yuandianxiao"></i>
                <div class="txt">{{item.infotitle}}</div>
              </a>  
            </li>
          </ul>
        </div>
        <!----工作开展动态情况----->
        <!-- <div class="special_work fl">
          <div class="title flex flex-align-center flex-pack-justify">
            <div class="wz">工作开展动态情况</div>
            <div class="more"><a :href="'/list?catid=' + work_id" target="_blank">查看更多</a></div>
          </div>
          <ul class="clearfix">
            <li v-for="item in work_news">
              <a v-if="item.returnurl && item.returnurl != ''" :href="item.returnurl" target="_blank" class="flex flex-align-center">
                <i class="iconfont icon-yuandianxiao"></i>
                <div class="txt">{{item.infotitle}}</div>
              </a>
              <a v-else :href="'/article?id=' + item.infoid" target="_blank" class="flex flex-align-center">
                <i class="iconfont icon-yuandianxiao"></i>
                <div class="txt">{{item.infotitle}}</div>
              </a>   
            </li>
          </ul>
        </div> -->
        <!----集中政治整训大家谈----->
        <div class="special_study fr">
          <div class="title flex flex-align-center flex-pack-justify">
            <div class="wz">集中政治整训大家谈</div>
            <div class="more"><a :href="'/list?catid=' + policy_id" target="_blank">查看更多</a></div>
          </div>
          <ul>
            <li v-for="item in policy_news">
              <a v-if="item.returnurl && item.returnurl != ''" :href="item.returnurl" target="_blank" class="flex flex-align-center">
                <i class="iconfont icon-yuandianxiao"></i>
                <div class="txt">{{item.infotitle}}</div>
              </a>
              <a v-else :href="'/article?id=' + item.infoid" target="_blank" class="flex flex-align-center">
                <i class="iconfont icon-yuandianxiao"></i>
                <div class="txt">{{item.infotitle}}</div>
              </a>  
            </li>
          </ul>
          <div class="opinion">
            <a href="/note" target="_blank">
              <img src="../../../assets/images/yjjy.png" />
            </a>
          </div>
        </div>

      </div>

      <!------ 底部-------->
      <div class="special_foot">
          <div class="foot_cont flex flex-space-around">
              <span>版权所有：东部战区总医院</span>
              <span>技术支持：医学信息数据室</span>
          </div>
      </div>


   </div> 
</template>
<script setup name="eight">
import { getMenu } from "@/api/yxzx/menu";
import { leftCategorylist } from '@/api/yxzx/home'
import { listpassInfo } from "@/api/yxzx/info";
export default {
  components: {
  },
  data() {
    return {
        navList:[
            {name: '首页', href:'eight'},
            {name: '通知公告',id: '', href:'/list'},
            {name: '学习教育资料',id: '', href:'/list'},
            {name: '工作开展动态情况',id: '', href:'/list'},
            {name: '意见建议', href:'/note'}
        ],
        photo_news: [], // 图片新闻
        notice_news: [], // 通知公告
        work_news: [], //工作开展动态情况
        study_news: [], // 学习教育资料
        policy_news: [], //集中整治整训大家谈
        opinion_id: '',
        study_id: '',
        work_id: '',
        notice_id: '',
        policy_id: '',
    }
  },
  computed: {},
  created() {
    this.getList()
  },
  methods: {
    /** 查询菜单列表 */
    getList() {
        this.loading = true;
        getMenu().then(response => {
          response.resultContent.map((item) => {
            if (item.categoryname == '八项规定专题') {
              leftCategorylist(item.categoryid).then((res) => {
                res.map((el) =>{
                  if(el.categoryname == '通知公告'){
                    this.notice_id = el.categoryid
                    this.navList[1].id = el.categoryid
                    listpassInfo(el.categoryid, "", 1, 7).then((req) => {
                      this.notice_news = req.InfoList;
                    }); 
                  } else if (el.categoryname == '学习教育资料'){
                    this.study_id = el.categoryid
                    this.navList[2].id = el.categoryid
                    listpassInfo(el.categoryid, "", 1, 7).then((req) => {
                      this.study_news = req.InfoList;
                    }); 
                  } else if (el.categoryname == '工作开展动态情况'){
                    this.work_id = el.categoryid
                    this.navList[3].id = el.categoryid
                    listpassInfo(el.categoryid, "", 1, 7).then((req) => {
                      this.work_news = req.InfoList;
                    });
                  } else if (el.categoryname == '集中政治整训大家谈'){
                    this.policy_id = el.categoryid
                    // this.navList[3].id = el.categoryid
                    listpassInfo(el.categoryid, "", 1, 4).then((req) => {
                      this.policy_news = req.InfoList;
                    });
                  } else if (el.categoryname == '图片新闻'){
                    listpassInfo(el.categoryid, "", 1, 10).then((req) => {
                      this.photo_news = req.InfoList;
                    }); 
                  }
                  // else if (el.categoryname == '意见建议'){
                  //   this.opinion_id = el.categoryid
                  //   this.navList[4].id = el.categoryid
                  // }
                })
              });            
            }
          })
          this.loading = false;
        })
    },
  }
} 
</script>